/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package apprentissagejava;

/**
 *
 * @author tordeepweb
 */
public class CalculetteV2 extends javax.swing.JFrame {

    /**
     * Creates new form CalculetteV2
     */
    public CalculetteV2() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButtonClic0 = new javax.swing.JButton();
        jButtonClic1 = new javax.swing.JButton();
        jButtonClic2 = new javax.swing.JButton();
        jButtonClic3 = new javax.swing.JButton();
        jButtonClic4 = new javax.swing.JButton();
        jButtonClic5 = new javax.swing.JButton();
        jButtonClic6 = new javax.swing.JButton();
        jButtonClic7 = new javax.swing.JButton();
        jButtonClic8 = new javax.swing.JButton();
        jButtonClic9 = new javax.swing.JButton();
        jButtonClicPlus = new javax.swing.JButton();
        jButtonClicEgal = new javax.swing.JButton();
        jTextFieldResult = new javax.swing.JTextField();
        jTextFieldTemp = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButtonClic0.setText("0");
        jButtonClic0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic0ActionPerformed(evt);
            }
        });

        jButtonClic1.setText("1");
        jButtonClic1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic1ActionPerformed(evt);
            }
        });

        jButtonClic2.setText("2");
        jButtonClic2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic2ActionPerformed(evt);
            }
        });

        jButtonClic3.setText("3");
        jButtonClic3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic3ActionPerformed(evt);
            }
        });

        jButtonClic4.setText("4");
        jButtonClic4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic4ActionPerformed(evt);
            }
        });

        jButtonClic5.setText("5");
        jButtonClic5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic5ActionPerformed(evt);
            }
        });

        jButtonClic6.setText("6");
        jButtonClic6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic6ActionPerformed(evt);
            }
        });

        jButtonClic7.setText("7");
        jButtonClic7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic7ActionPerformed(evt);
            }
        });

        jButtonClic8.setText("8");
        jButtonClic8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic8ActionPerformed(evt);
            }
        });

        jButtonClic9.setText("9");
        jButtonClic9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonClic9ActionPerformed(evt);
            }
        });

        jButtonClicPlus.setText("+");

        jButtonClicEgal.setText("=");

        jTextFieldResult.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldResultActionPerformed(evt);
            }
        });

        jTextFieldTemp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldTempActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextFieldTemp, javax.swing.GroupLayout.PREFERRED_SIZE, 330, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addComponent(jButtonClic4)
                                    .addGap(18, 18, 18)
                                    .addComponent(jButtonClic5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jButtonClic6))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(jButtonClic1)
                                            .addGap(18, 18, 18)
                                            .addComponent(jButtonClic2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addComponent(jButtonClic0, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jButtonClic3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jButtonClicPlus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jButtonClic9)
                                .addGap(18, 18, 18)
                                .addComponent(jButtonClic7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jButtonClic8)
                                .addGap(13, 13, 13)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonClicEgal, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldResult, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(75, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(96, Short.MAX_VALUE)
                .addComponent(jTextFieldTemp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonClic8)
                            .addComponent(jButtonClic7)
                            .addComponent(jButtonClic9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonClic6)
                            .addComponent(jButtonClic5)
                            .addComponent(jButtonClic4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonClic1)
                            .addComponent(jButtonClic3)
                            .addComponent(jButtonClic2)))
                    .addComponent(jTextFieldResult))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonClic0)
                    .addComponent(jButtonClicPlus)
                    .addComponent(jButtonClicEgal))
                .addGap(33, 33, 33))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonClic3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic3ActionPerformed
           if (jTextFieldResult.getText().equals("0")) {
            jTextFieldResult.setText("3");
        } else {
            String result = jTextFieldResult.getText();
            result += "3";
            jTextFieldResult.setText(result);

        }
       
    }//GEN-LAST:event_jButtonClic3ActionPerformed

    private void jButtonClic4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic4ActionPerformed
              
       
       
    }//GEN-LAST:event_jButtonClic4ActionPerformed

    private void jButtonClic5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic5ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jButtonClic5ActionPerformed

    private void jButtonClic6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic6ActionPerformed
        // TODO add your handling code here:
       
    }//GEN-LAST:event_jButtonClic6ActionPerformed

    private void jButtonClic7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic7ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jButtonClic7ActionPerformed

    private void jButtonClic8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic8ActionPerformed
        // TODO add your handling code here:
       
    }//GEN-LAST:event_jButtonClic8ActionPerformed

    private void jButtonClic9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic9ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jButtonClic9ActionPerformed

    private void jButtonClic0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic0ActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jButtonClic0ActionPerformed

    private void jButtonClic1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic1ActionPerformed

        if (jTextFieldResult.getText().equals("0")) {
            jTextFieldResult.setText("1");
        } else {
            String result = jTextFieldResult.getText();
            result += "1";
            jTextFieldResult.setText(result);

        }

       
    }//GEN-LAST:event_jButtonClic1ActionPerformed

    private void jTextFieldResultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldResultActionPerformed
        // TODO add your handling code here:
        jTextFieldResult.setText("0");
    }//GEN-LAST:event_jTextFieldResultActionPerformed

    private void jButtonClic2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonClic2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonClic2ActionPerformed

    private void jTextFieldTempActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldTempActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldTempActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CalculetteV2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CalculetteV2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CalculetteV2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CalculetteV2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CalculetteV2().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonClic0;
    private javax.swing.JButton jButtonClic1;
    private javax.swing.JButton jButtonClic2;
    private javax.swing.JButton jButtonClic3;
    private javax.swing.JButton jButtonClic4;
    private javax.swing.JButton jButtonClic5;
    private javax.swing.JButton jButtonClic6;
    private javax.swing.JButton jButtonClic7;
    private javax.swing.JButton jButtonClic8;
    private javax.swing.JButton jButtonClic9;
    private javax.swing.JButton jButtonClicEgal;
    private javax.swing.JButton jButtonClicPlus;
    private javax.swing.JTextField jTextFieldResult;
    private javax.swing.JTextField jTextFieldTemp;
    // End of variables declaration//GEN-END:variables
}
